package com.media.entrance;

import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Hello world!
 *
 */


@SpringBootApplication(scanBasePackages = "com.media.entrance")
//@NacosPropertySource(dataId = "application.yml", autoRefreshed = true)
public class MediaEntranceApplication //implements CommandLineRunner
{

    public static void main( String[] args )
    {
        //设置环境变量
//        System.setProperty("nacos.config.serverAddr","http://1.94.104.170:8848");
//        System.setProperty("nacos.config.username","nacos");
//        System.setProperty("nacos.config.namespace","public");
//        System.setProperty("nacos.config.password","nacos");
        SpringApplication.run(MediaEntranceApplication.class, args);
    }

//    @NacosInjected
//    private NamingService namingService;
//
//    @Value("${spring.application.name}")
//    private String applicationName;
//
//    @Value("${server.port}")
//    private Integer serverPort;
//
//    @Override
//    public void run(String... args) throws Exception {
//        // 通过Naming服务将本服务注册实例到注册中心
//        namingService.registerInstance(applicationName, LocalAddress.getIpAddress(), serverPort);
//        log.info(applicationName + "alreay register to nacos : " +  LocalAddress.getIpAddress() + ":" + serverPort);
//    }
}
